package com.blog.controller.forntend;


import com.blog.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author mars123
 * @since 2019-07-02
 */
@Controller
@RequestMapping("/frontend/article")
public class ArticleController {

    @Autowired
    private ArticleService articleService;

    @RequestMapping("/view")
    public String view(Integer id, Model model) {
        if (id != null) {
            model.addAttribute("article", articleService.view(id));
        }
        return "frontend/article/view";
    }
}

